/*
 * Copyright (C) 2023 HiHope Open Source Organization .
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 *
 * limitations under the License.
 */

#ifndef PZCAR_WHEEL_CTRL_H
#define PZCAR_WHEEL_CTRL_H

#include "ohos_init.h"
#include "cmsis_os2.h"

#include "net_config.h"

typedef enum {
    eMode_Auto,
    eMode_Track,
    eMode_AudCmd,
    eMode_NetCtrl,
    eMode_Max,
} CarMode;

typedef enum {
    eSt_Stop,
    eSt_Forward,
    eSt_TurnLeft,
    eSt_TurnRight,
    eSt_Backward,
    eSt_BackLeft,
    eSt_BackRight,
    eSt_Max,
} CarState;


typedef enum {
    eSp_Min = 0,
    eSp_Low = 1000,
    eSp_Medium = 2000,
    eSp_High = 3000,
    eSp_Max = 3600,
} CarSpeed;

typedef struct {
    CarMode  e_CM;
    CarState e_ST;
    NetState e_NetST;
    NetCtrlMode e_NetMode;
    osThreadId_t netCtrlTaskId;
    osThreadId_t udpServRecvTaskId;
    osThreadId_t tcpServRecvTaskId;
    unsigned char apInited;
    unsigned char staInited;
    short    d_speed_curr;
    short    d_speed_def;
    short    d_speed_min;
    short    d_speed_max;
    short    d_duration;
    short    d_duration_def;
} PzCarInfo;

void WheelMovementCtrl(CarState eSt, const signed short speed, const unsigned short duration);
void WheelMovementCmd(const char* cmd, const signed short speed, const unsigned short duration);
void WheelCmd(const char* cmd);
osThreadId_t WheelTaskEntry(void);

#endif // PZCAR_WHEEL_CTRL_H